I was wrong yesterday, in that I thought my code was wrong, but I was wrong and my code was right.
I had just written a lousy test data set with data in it that was wrong. Legal, but wrong for what I wanted to do.
Once I fixed the test data so that it was right, the code did the right thing.
There is nothing I can do except admit it in my song...