fix keyboard input bug