Fix panic problem while downloading file