fix autojoin channels
add more unit tests