correct range computation in connectedcomponents stats

I originally tried doing a more efficient implementation but it was difficult to do correctly in this context and the version I had ended up incorrect.  Instead I'm using simpler version.