fix bugs with bit_diff