fix a bug with restart downloading in multithreading