improved invariant error message