added sanity check for duplicate IDs