Fix various warnings found by MSVC