Fix indexInArray to use the correct array object