Fix win32 compilation

Closes #1137.