Fix errors with MinGW and MSVC