Fix localip not return ip address correctly  under some particular configs.