Fix assertion failure in debug MSVC build