fixes to tcp connection