improved checkEdges to stop, if there is no single possible reference