fixes to xp_socket.c
fixes to plain stream wrapper