bug fix for duplicate check