The error lies in this: $gettok($gettok(%b,1,44),2,61)

The $readini returns the value which is already the 2nd equal sign delimited token, so that $gettok(...,2,61) isn't needed there, and actually makes the return value empty.

n10=#channel, "blabla", "blabla"

$readini returns: #channel, "blabla", "blabla"
$gettok(%b,1,44) returns: #channel
$gettok($gettok(%b,1,44),2,61) returns:

Greets