Fix for Issue #1 and a change to how the $api_ip is interperted.