Fix deletion of treatment factors

Reviewer: Daniel Villafuerte

Issue: GCP-9643