use ip if hostname fails

minjor indentation fix