Added a Flush before Waitev's event handling.