Fixing event-count sort