nice spotting for generalising the code
I think it would be worth adding a unit test for this case, since this was not picked up until now for future proofing