it turned out to be that, this part of the code works fine.
However, the tl_new() function returns some value that already exist returned by other tl_new() function call.
So it boils down to the question:
Does tl_new() guarantee to return a UNIQUE value every time it gets called? If not, then problem occurs. How can you fix this?
Imagine in a situation that multiple TLs are generated and deleted dynamically from time to time, how can you make sure each TL has its own unique ID (handle) is crucial. How do you implement this in MC?
The problem is in your code.
I can say that because the problem you described is a simple one,
if it were a bug, it would have been discovered long ago.
Thousands of people uses drawing objects everyday with no problem.
I would recommend you to review your codes again line by line,
and to reduce complexity wherever possible.
ps. good coding habit helps too.