Issues with 'Sort list of Bible references in Bible order' script
I found an awesome little script here that sorts the books of the Bible in canonical order but I just now noticed a strange bug, and I'm not sure what is causing it. 😞
Background
I am generating a Scripture Index at the back of my book in InDesign, using character styles and then Peter Kahrel's great little "Index from Character Styles" script. After I generate the Index, I end up with a list of scripture references in alphabetical order with page numbers after them like this.

Now I need to sort this entire scripture index to be in canonical order (instead of alphabetical order). But after selecting the text and running the sorting script, I end up with this 😞 :

The books are in the correct order, but the chapter numbers are all out of sync! 😞 I suspect that it's the page numbers that are throwing the script out of whack, but I can't verify that, and neither do I know what to do to fix it. I'm slowly learning some simple scripting in InDesign, but this script is a bit above me yet. Does anyone have any pointers for me? @Magnus Gaarde is the one who wrote the script, but I don't know if they are still around on the forums or not.
Thank you in advance if you can help me out!
