Add function to invalidate key