Fix the duplicated index issue