added check invariants