fixed sudbstring index