Some fixes of tsmconnection.

Added som TODO's for future improvements and some fixes.