Fix non-windows event code

And remember to compile on non-windows systems before committing