Changed code a little it to make it compatible with ZMQ 3