One of your function calls is returning undef. I can't think of much more to say.
In reply to Re: What is a by tye in thread What is a by BlaisePascal