fix events to be ordered