Fixed undo/redo  (won't crash)