fix bug of gallery index