Fix some warnings and errors while compiling on Windows