fixed progress printing loop