enforce-security and improved error handling for failed downloads