A few fixes for MSVC