Patched it to work with mingw cross compiling