fix tmplate index issues