fixed event sorting bug