fix segfault on switching channels