modify the invalidate code