Fixed bug relating to keyboard input