Bug fix on index creation