Fixed database bug so items are only added once