Fix a number of warnings on MSVC