agent: fixed call to base64 encode (doesn't return errors)