Fix a bug when getting IP addresses