fixed the algorithm - now it will always work when the progress bar is flat