Fix return value for top layer

Turns out you can't access a lua "for" loop index directly. No biggie.