fixed the undo button function