UDT Tag Changed Event - Sometimes won't reset the tag

I have a UDT with around 250 tags. From this UDT I’ve created 50 tags.
Three tags (triggers) in the UDT have ‘Tag Value Changed’ event defined:


The script is writing a few values in the database and when the writing is done, it reset (set to false) the same tag that fired the event. Most of the time, the script is working fine.
But, what’s happening is, that every once in a while (5min, 10min, 1 min,…) the tag, which fired the event, won’t get reset and is staying on True.
This three tags, triggers, are set by the S7-1515 PLC every ten seconds to True, and I (Ignition) must set them back to False. When the trigger stays on True, we miss the data…
I’m banging my head for two days now. I’ve tried many things, but nothing is helping. I even ended with ‘system.tag.writeSynchronous(tagPath, False, 1000)’ but is not any better…
These three triggers have their own scan classes defined (1s). I also tried various times (1s, 2s, 0.5s,…)…

Is there anything I can do better or is there any other way?