Win32 fixes

Two commits that fix the tests on windows. You might want to copy some of that to the unix parts too.