The day has come. I've seen the light with ChatGPT. I had been chasing this bug down for days and couldn't find what was causing it... so I asked ChatGPT, giving it the code I wrote. It found the problem and suggest a (valid) solution in a minute. Mind blown.