fixed undo bugs