fixed undo crash bug