added: better error handling for curl download