Fix issue with duplicate ids