Fixed the key-event problem