progressbar working correctly