added error checking when looking up IP