MinGW compatibility fixes