Picking trouble

I am having trouble with my picking.
My code looks fine and I’ve gone over it plenty of times but I can’t find the error.
What happens is when I click and it selects 2 objects all is fine. but if it gets
3 or more then the next time I click anyware glRenderMode(GL_RENDER)
returns the number of objects in the scene.
Even if I didn’t click on one. Even if they have been culled by hardware.
(ie out of screen without me doing any culling)

why?
My selection buffer is large enough

I’ll tell you what I tell everyone who asks about picking: don’t use the selection mode, do the picking yourself (with some sort raycasting or whatever). Selection mode is deprecated, unconvenient and slow ( runs in software).

Color picking works fine and runs in hardware. You could use that.