Changed $api_ip to $api_addr