Fixed bug of duplicate index() function