fix undo bug
more detail comment