replace all instances of untyped with cast