Fix duplicates inside duplicates test case #504