fix problem with invariants