fix socket write