fix for undefined index when gethostbyname fails