use the new MemoryBuffer interfaces to simplify error reporting in clients.