Fixed ZipWithIndex using mutable state (not pretty)