Improve remote IP address handling