Build fixes for MinGW