Fixed array index out of bounds