fix undo/redo for AI