Fix the progress code to output LF only when it is really needed