Fixed a couple bugs in the event handling system