Repairs bug when re-executing (#2781)