Fix mingw based builds. Fixes #587
Merge pull request #588 from jonforums/mingw-fix

Fix mingw based builds. Fixes #587