making sure to delete type key if type changes for cas