fix Win32 bugs, add more Win32 tests