Bug fix in the ring building algorithms