Small fixes for templates and additional fixes for metadata edit