Win32 fixes

Make it work under windows (win32)