correcting distance metric for similarity