bug with sorting events