fix the order of events