Make undo / redo resilient to all exceptions