MSVC compatibility fixes