Backporting LIBZMQ-569 fix from master