minor bugfixes in download file code