Fix events sorting