fix detect primary ip for hostname