Bugfix: set_index() failed when given negative i, bug introduced when adding caching.