Fix: only use loopback IP address as last resort