fix file-download ending too early