fixed bug when copying template file.