Small change to compile on Visual Studio 2010, and remove some cast warnings.