Fixed a lot of MSVC problems