fix #20996 #20994
update for bug #16047: fix crash on undo