fixed some memory leaks and crashes related to tbs_bot