fix some reference errors, fix a bug with private channels