bugfixes in download routine