copy template before execution.