Corrected indexing error