fix removing hosts failure on MacOSX