Code fixes to get things somewhat compiling on Windows.