Thanks for checking. It fails at the first event.
About the latter comment, I am confused. Isn't this what I was doing at the beginning, with the track_counter index? (see line 86)