fixed template loop