fixing tsmain.cpp a little bit