bugfix: better memory handling in TcpServer

+ don't delete objects before they are accessed:/