Fixed keypressed handler's bug