changed decoding range to [0, range]