Check for template path before copying template

This fixes #419.