debug for undo