Replaced some old style C casts to use static_cast.