0mq fixes; credits to Hongfei Cheng and Brian Knox