fix hex to bit function