Okay, the issue is as follows. The bug (or more correctly, corner case) is triggered when: - You use toroidal lookup - Your distance measure is inappropriately large for the field. In your example, you had a 10x10 field but a 5-distance lookup, which is huge for this grid. Consider the width of the rectangle region that's looked up. At 5, the width is 5 left, 5 right, and the center location, for a total of 11 units wide. But the field is only 10 units wide! So what's happening is that one of the units is wrapping toroidally over to the other side, resulting in a few grid squares being looked up twice.