Oh, so I was being SUPER dumb. (My words, not yours.) I didn't even think to check how vanilla sorted them before thinking something had gone wrong; they're in the correct order based on that criteria. Sorry for wasting your time, I should have checked that first, but thank you for telling me. I'll be more diligent about testing in future.