Fixed a bug in the EventManager