Fix bug in index add