repaired ivalid read on socket