fix the remote addr calculation