fixed .val(values)

loop deleting existing ranges now starts deletion from the last range, which is fixing cases when amount of new ranges is shorter than amount of existing ranges.