Fix a bug checking if the ip on the list is a valid IP