added better error handling for broken ip addresses