Fix incorrect check when adding items.