Corrected xs array index