fix progress bar overflow and divide by 0 error