fix num_bits range check