fixed potential segfault in resolve_hosts