Added some typecasts to make Visual Studio happy.