Changed c style casts to C++ style casts