Fixes for working with mingw on Windows