fixed some malloc issues
added length check after nuking connecntions on channel_unbind
final version before submission