Use C++ style casts instead of C-style casts to shut up compiler warnings