Merge pull request #315 from lazka/fix-iter-length

Fix loop context length calculation for iterators. Fixes #244