Mingw-w64 fixes under gcc-4.8.2

Hi James, here are the few patches needed to compile on my windows 8 box. - Jason