bugfix
bugfix
avoid close socket duplicate
bugfix in Mac OSX