use substring instead of split