Fix some warnings and errors for MSVC.