Fixed a memory deallocation issue related to clearing templ_stats hashmap
Fixed a memory deallocation issue related in intermediate_process_message (related to tm_key_create)