fix bug in string generation