backport from erasing