improved event count hack