Fixed debug build on Windows

Patches on master by James Emerton, from github pull request #8.