removes unnecessary casts