Fix error when index are empty