fixing issue for out of index