Misc fixes for Win32