Fix another bug in deploy_templates