Fix undo when lose