Undo-erase functionality bug fix