This code works 99.5% of the time...

I’m doing a thing for a guy, the core chunk of code is this…

	if (imagetimer.totalseconds() > 10) and (fadelevelA.[0] = 255 )  then
		print "mark " + imageindex.tostr()
		print "Checking for " + randpics[imageindex].url + " -> " + "tmp:/"+imageindex.tostr()+".jpg"
		if files.exists("tmp:/"+imageindex.tostr()+".jpg") = false
			Print "Downloading " + randpics[imageindex].url + " -> " + "tmp:/"+imageindex.tostr()+".jpg"
			timer.mark()
			http.SetUrl(randpics[imageindex].url)
			http.GetTofile("tmp:/"+imageindex.tostr()+".jpg")
			print "...Downloaded in " + (timer.totalmilliseconds()).tostr() + "ms."
		else
    			print "Already Exists: " + "tmp:/"+imageindex.tostr()+".jpg"
		end if
	
		timer.mark()
		'loads in the next image to be transitioned to
		bm=CreateObject("roBitmap", "tmp:/"+imageindex.tostr()+".jpg")
		images.push(bm)
		print "Drew screen in " + (timer.totalmilliseconds()).tostr() + "ms."
		if imageindex = (randpics.count() -1) then imageindex = 0 else imageindex = imageindex + 1
	end if
	'After 10 seconds, transitions between images[0] and images[1]
	if (imagetimer.totalseconds() > 10) and fadelevelB[0] <= 254 then
	    fadelevelA[0] = fadelevelA[0] - 1
	    fadelevelB[0] = fadelevelB[0] + 1
	end if
	'when the transition is finished, reset fade levels, timers and move next image up to current.
	if (fadelevelB[0] = 255) and (imagetimer.totalseconds() > 10 ) then
	    fadelevelA[0] = 255
	    fadelevelB[0] = 0
	    images.delete(0)
	    imagetimer.mark()
	end if

	m.screen.Clear(&h00000000)
    	if images.count() > 0 then m.screen.DrawObject(0,0,images[1],HexToInteger3("FFFFFF" + fadelevelB.tohexstring()))
    	m.screen.DrawObject(0,0,images[0],HexToInteger3("FFFFFF" + fadelevelA.tohexstring()))

	m.screen.SwapBuffers()

it cycles an array of image urls, downloads them (if they don’t exist already) and cross-fades them.
that works 99.5%of the time, but on some super rare occasions, it does this…

https://www.youtube.com/watch?v=vU-gl4RXa3w

Here, it’s showing a blank screen, it begins to show the next image only as the cross fade begins and fades to black. I can’t figure out what causes it, and I’ve only seen it on my Roku LT. The guy I’m doing this for can get it to happen a little more often on his Roku 3.

Any ideas?