Template Repeater Template Display Glitch

I am running a nightly build of 8.1. I need the nightly build due to needing some system.opcua functions.

I am having an issue with a template repeater and a template that seems to display incorrectly even though the generated data looks good. I have bound a function on the dataset of the template repeater. This dataset is updated when certain tags change.

Here is the bind for the template repeater:


This calls the buildDataSet function:

def buildDataSet(self, segmentMax, currentSegment):
        headers = ["segmentNumber", "segmentMax", "currentSegment"]
	build = True
		segmentMax = int(segmentMax)
		currentSegment = int(currentSegment)
		segmentMax = 3
		currentSegment = -1
	data = [[i, segmentMax, currentSegment] for i in xrange(segmentMax)]
	dataset = system.dataset.toDataSet(headers, data)
	system.tag.configure("[default]", opcuaServer.genHistoryTag("testtag"))
	return dataset

The template itself takes these parameters from the dataset and this expression is bound to the imagePath of an Image component:

     0, "Amet/xmgui/seg0000.png",
 	 {WeldSegment.segmentMax}-1, "Amet/xmgui/seg0002.png",

The data I write to a test tag during the buildDataSet call to see what it is actually sending to the template repeater:

0	3	-1
1	3	-1
2	3	-1

So the result should look like (and it does most of the time):

But occasionally it looks like this:
When it looks like this the dataset looks the same.
But the templates that are repeated are acting like they got only zeros (0,0,0) in the first column of data instead of 0,1,2.

I am not sure how to address this.