some cherry-picked (manually) adjustments from the item-add branch