Win test fixes

After these changes, all the tests pass on Win/Mac/Linux (Tested on Windows 8, Ubuntu 12.10 and OS X 10.8.3)