Corrected template file
Fixed bug that caused infinite loop