add the $length property to the loop context after each iteration, sub loops could remove it