fixed some stuff in ProtocolSocket