MinGW build fixes