Fixed undo/redo not working as expected for selected item removal.