fix a bug of event handling on Windows.