Fixing MSVC compilation errors and warnings.