fix bug of invariant