What you need to do is clear the keyboard buffer before you start to collect the response.
event.clearEvents()
See also