Ok, I think you are right, but it is broken the same way in the factored out code.

Fixing.