fix string generation bug