fixed bug for index