It is also curious that those are the 2 outputs you cycle over. I’m a little out of ideas.
I would probably check the output after each step, help narrow it down more. Currently, it would seem it is something to do with generate, or some state in generator