Undo in a thread