replaced c-ctyle casts with c++ style