bug fixed for index