Many fixes to get vc11 working.