Fix key event processing