fix the order of operations in event