Remove defect for building a string in a loop