substring related problems