Fix MSVC errors and warnings.