MinGW fixes and warning reduction