fixed the mode switching with the keypad