make sure events are written in order