Problems picking the right object

I try to pick objects using the glSelectBuffer and the glPickMatrix.
I get the correct number of hits using glRenderMode(GL_RENDER).
Then I try to get from the buffer the object name that is closer to the camera.
but I cannot understand the way data is passed into the buffer.
e.g. once I click on three objects I get somthing like
1,mindist,maxdist,1,2,mindist,maxdist,1,2,3,mindist,maxdist,1,2,3,…
and another time something like
1,mindist,maxdist,1,3,mindist,maxdist,1,2,3,4,mindist,maxdist,1,2,3,4,…

How should I read the buffer?
Is there another ,easier or faster, way to get the selected object name?

Maybe it’s due to you pushing names.
There is no need to do this.
Push name only once at start, then just glLoadName.

Randy