Fixed compilation errors on Windows, plus an error in a test case