fixed keypress unvalid bugs