Fixed bugs on segment index