fixed weird undo bug