was resuing template_file through loop