fix socket reading problem