Also stringifies keys in _template_attrs in _todict

I don't know if this is how you'd like to build the dict but I can load the dictionaries again.