Shouldn't be an issue, but try inserting $chan before $nick in the ban statement.