fix the index problem