replaced index with correct index