fix undo after a fail