Some adjustments to TCP logic for GitHub issue #60