finally getting data download to work properly