fixed problem with invariant