Modify to build with mingw toolchain