Improved get_client_ip() fn