ok! even better. $chan is $null because it has no place in "on QUIT" or "on DISCONNECT" or whatever words it takes since the documentation may mislead one to believe $chan is always defined to something other than $null. Instead use $chan(N).
My research into why $chan was $null (the reason for it was not clear), I only found $comchan mentioned here in a Forum post.
as for the long boring read, the quoted text doesn't exactly throw light onto the "me" level sufficient for clarity. yes, it's a deep detail but it shouldn't be murky!