fix for working with substring of the line.
add a test case for substring.