improved performance for invariant necessity check