changed all old style casts to new style c++ casts