improve invariants