added mutex locks to channel funcs