Fixed index in array not found bug