A few compile fixes for mingw32