added more condition on test of duplicates