fixed a logic error in EventManager