Fix warnings and errors with MinGW