add the event count function