Use DNS_ERROR instead of -1 where appropriate