Mingw32 fixes

Some fixes to allow mingw32 compilation :).