Fix for rings with "holes" in devices.

Fixes a problem I noticed, using a real-world ring from a 31-node cluster.