fixing index code