fixed undefined channels variable bug