Fix bug in index