Refactor BN_R_NO_INVERSE logic in internal functions