Well I don't know why the way $chan($chan).mode returns it is not good enough, but just use $replace:

$replace($chan($chan).mode,$chr(32),$chr(44))