Very rough hack to make everything compile and run under vs2013.

See change list