@GeorgeEdison I'm really uncomfortable with that scope and I think that's your issue.
Basically the floating function ("callback") is well out of the scope of the loop by the time it's called. The variable it now equals has changed. all the way up to the latest item.
I think you probably want to be more robust with your assignment so that whatever object is calling the callback has its own reference to its number - or at least has some indestructible way of looking it up.