Added exception handling to the event manager