Fixed sorting of events