Fixing Segfault for gethostbyname