Second patch from X-Fixer: tweaks for better MSVC build