better handling of zmq socket