fix handling of exceptions in SecureAgent's send