fixed iteration bug
fixed wrong argument name
moved some logic from Channel to Client