Fixed a bug in rightclick undo