Fixed a few bugs introduced in the rework of the keypress logic.