MSVC fixes for Windows build