Minor fix to gather-templates code