Fixed MSVC 2013 build errors and workaround for an internal compiler crash.