code to find next id when a bunch of id's don't resolve