Add missing metadata when changing template contents