Code cleanup: unused imports, debug output
Test infrastructure: bug in error recovery on download failure