fix issue #11

use a variable to hold the starting position of a string