file templates

+ fix for writing templates to newly created files
+ byte order mark in template files