Finished fixes for MSVC