fixing tcp receive and send