improve tg-mode