fix duplicates bug