Append extended hamming distance, fix bug with write in db