Fixed some code for msvc.