Fix some incorrect invariant checks.