changed decoding, added requiredBits == 0 support