For me it looks like a memory corruption bug or smth., I remember years ago on one line value of variable is one a few lines down is completely another, even though nothing modified the value.
I would like to know what BackgroundHALShouldPause does, and how to use it. While it's listed in the HAL Primitives report, it is not used in source code and it doesn't appear in the LMS HAL...