build fixes for mingw