fixed socket bugs