added hamming_distance2 support