Hello,
What is inside the $ret variable in your case?
I don't have the code here at work to quote from, so you'll have to bear with me :). My understanding of the initial connection to Gallery2 in this code is that it's just an initialization, and nothing would be returned by the $ret variable ...