Fix bugs in template  editing. Allows rename of template Names