fixed double template bug