invalidate only if necessary