fixed template switching issue