Fixed all build errors in Windows (MSVC tested)