Fixing the order of the events generated in csv