Fixed indexing error