correct the substring