fixed key-exited/key-entered bug