fix hamming method