Fix compile issues and test failures in VS2008.