similarity measure bug fix