Fixed keydown handler