added mutex lock to channels and sockets