Fixed an xref bug.

This bug was introduced in a previous commit (b9da8ebeddbb95a8a4fba9777815fb6350bf1e40). The offset variable should be set to "length+1", however, it was accidentally changed to "length" in the aforementioned commit.