Minor fix in the similarity function