corrected some index mistakes