Fixed addEvent routine