Fix events handling on win32