Fixed TCP code to work