rewrite cast