Fix wrong array index