I am a bit out of my depth here, as I don't use tool radius compensation. But the line N187 worries me: a D parameter without the G41/G42 command in the line, just like that, seems unwise. It seems even more unwise when it is invoked in the middle of a series of G1 commands.
In the OK case, there is a D02 followed by NO movement before tool compensation is turned off. No problem apparent. But in the FB case there is a G1 movement after the D command, before tool compensation is turned off, and it may be that an abrupt change like this is what is causing Mach to go wonky. It may be trying to correct for tool radius before doing the G021 movement. That is something I would NOT do.
As a diagnostic, can I suggest commenting out the D command and trying both versions?
Cheers
Roger