rework the hosts management to write a hosts file