Fix msvc2013

This branch fixes several compiler errors caused by shortcomings & bugs in VS2013 Update #3.
While it still doesn't build, there are about half the number of compiler errors.