Using correct way to get hostname value