Ensure TM table is refreshed when last TM is deleted
Fix creation of TMs