fix events sorting