Add fail safe to replace script