fix bug in client when listening on arbitrary remote ports