Fix flattened arrays of arrays in loops.

Closes #207.