Fixes for MinGW (ref #6)