Fixed indexing issue