fix for undefined index when gethostbyname fails,  take2