Patches for check_tcp cleanup (take 1) [sf#1211624] [#480]