Fix mysterious nil exception that occasionally happens when modifying hosts file.