fix a download bug by changing the order of startDownload and InsertDatabase