Ah, that's because the map events array isn't structured like this.
It actually is the length of the maximum id of the events in editor (with position 0 being null), and doesn't fill the empty IDs.
So, if you had events with ids 1,2,6 and 8 on map, the array would be: [ ,event1,event2, , , ,event6, ,event 8].
You do have positions 0-3-4-5-7 they are just empty (null).
Edit: It seems I made a mistake.
Position 0 isn't filled with a placeholder event as I thought, but after checking, it's just null. This doesn't really change anything. But well, for the sake of precision I thought I should update my answer.
It actually is the length of the maximum id of the events in editor (with position 0 being null), and doesn't fill the empty IDs.
So, if you had events with ids 1,2,6 and 8 on map, the array would be: [ ,event1,event2, , , ,event6, ,event 8].
You do have positions 0-3-4-5-7 they are just empty (null).
Edit: It seems I made a mistake.
Position 0 isn't filled with a placeholder event as I thought, but after checking, it's just null. This doesn't really change anything. But well, for the sake of precision I thought I should update my answer.