You might be asking why this happened ? Inside a UDF, there is a special $variable that is reserved for returning a value from that function, the variable is $+Functioname so for the merlin function, one would use $merlin as the special variable name. Well, in the code posted above, $merlin was being used to contain the merlin object.

By the same token, sometimes this feature can be very usefull, and actually not too sure why it was mis-behaving in your case. You were simply using $merlin to host the object, which is cool. But I figured that this wasn't you original intent anyways ...

-Shawn