No problem, I learnt something too! Remember to mark the original question as resolved.
This does indeed sound like a bug in the generated code. I’ll file a ticket to get it fixed.
Do not be afraid to file bug reports. I just happened across this thread but otherwise this would have been missed.
I shall be sure to file a report next time something like this happens