fixed invalidation code invocation condition