It appears that whoever changed the name of the range parameter to encode didn't rename the parameter everywhere in the function.