Improve indices handling