adding flush() to the progress bar update