Fixed a bug in input event handling.