Fix index names and duplicated lines