fix a bug in addItem()