fixed some bugs regarding templateswitcher