add invariant validation