Improving TCP proxy script

Bug fixes and remove some debug prints