Limit the undo on failures to only stop or scale down

Refactor undo