Fixed bug in keypressed