Fixed bugs in EventManager