Remove race condition in keyup event handler

Fix bug #119. I've only checked this by injecting it into an open page, as I don't want to set up an entire camdram deployment for this small bug.