Fix duplicates bug following 4.0 merge