minor tweak to the way the TM .def is created and stored as it was failing in the previous version.