bugfixes tcp (crash at shutdown, broken communication)