fixes to get_real_ip function.