Rotation and picking

I have followed one of the picking tutorials on the web and it worked fine until i added rotation of the hole view using a trackball. Then it marks the right object when I first click on them, but if I rotate the view, the picking is totally messed up.

Any ideas what’s wrong?

The code is organized like:

enter selection mode;
draw objects;
get the results;
process results;
mark picked object;