Applescript not getting correct graffle

Using this code,

tell application "OmniGraffle"
	set graffleName to name of its document 1
	tell canvas of its document graffleName
		set {o's theSols} to (every graphic of it)
		local tst
		repeat with i from 1 to (length of o's theSols)
			set tst to origin of (contents of item i of o's theSols)
			set end of o's sorted to {item 1 of tst, item 2 of tst, id of item i of o's theSols}
		end repeat
	end tell
end tell

CustomMergeSort(o's sorted, 1, -1, compObj1)
set o's sorted to rest of o's sorted

set tmpL to {}
repeat with i from 1 to (count o's sorted)
	set end of tmpL to item 3 of item i of o's sorted
	if (i mod 13) = 0 then
		set end of o's prepp to tmpL
		set tmpL to {}
	end if
end repeat
-- We are now having a list of list with id's of graphich objects resembling the rows of the
-- results table.

I am trying to get the ID’s of every object in my graffle. It gathers IDs that are meaningless and don’t correspond to the ID’s on my graffle. Does anyone have any clue what this could be? I didn’t write this script, and there are other parts to it, but this seems to be the part to be giving me issues.

Any help would be appreciated!