It's not a bug. In many mirc identifiers that accept a numeric parameter, a non-numeric argument is taken to mean 0, so the identifier returns the total number of items. In $chan(), that accepts either a number or a valid channel name (ie one that starts with a character in $chantypes), any string that is neither is considered 0.