Bug fix on index usage