fix bug in string substitution