modified code of apply_patchfile.py and download_patchfile.py