updated isDuplicate