Ok, I found what triggers the bug: It’s the time different from the real time.
If the time you fly in the simulator is different from what it is in real life, the bug will be triggered. For the bug not to trigger it is necessary to enable real time.
Hope this helps anyone who is experiencing the same issue.