mingw fixes

This PR fixes some issue's picked up when building with Strawberry perl on Windows.