More robust DNS/IP lookup