fixed template handling