add keystroke input validation