Mingw fixes

Fixes for compiling on MinGW - on the screenrewrite branch.