fixed a bug in event-counter