fixed the progressbar problem using threading