fixes for Windows

If you merge this, all tests are passed on Windows.

I hope this fixes #428.