allow nbits = 31 in read_bits
Oooops, typo