How to properly update templates? [SOLVED]

Hi,
I have a plugin (Reverso) with a model and a template. I need to update the template (css and tmpls).
I do it with this code:

    def modify_template(self):
        if '.xdocument, .lang' in self.model['css']:
            return
        self.model['css'] = CSS
        self.model['tmpls'][0] = TEMPLATES['default']
        self.model['tmpls'][1] = TEMPLATES['reversed']
        mw.col.models.update(self.model)

That works partially. It raises an error (below) but if I restart Anki, everithing is ok. What it the proper way to update a template?

I SOLVED the issue with a minor change:

self.model['tmpls'][0]['qfmt'] = TEMPLATES['default']['qfmt']
self.model['tmpls'][0]['afmt'] = TEMPLATES['default']['afmt']
self.model['tmpls'][1]['qfmt'] = TEMPLATES['default']['qfmt']
self.model['tmpls'][1]['afmt'] = TEMPLATES['default']['afmt']
mw.col.models.update(self.model)

I forgot to include the traceback of the error:

Debug info:
Anki 2.1.16 (dev) Python 3.7.5 Qt 5.13.2 PyQt 5.13.2
Platform: Linux
Flags: frz=False ao=True sv=1

Caught exception:
Traceback (most recent call last):
  File "/misc/src/git/anki/aqt/browser.py", line 98, in data
    return self.columnData(index)
  File "/misc/src/git/anki/aqt/browser.py", line 245, in columnData
    t = c.template()['name']
KeyError: 'name'