Issue #4: fix some bugs that prevented thread halting of download