More fixes around RPC calls that help avoid memory leaks when using RPC calls.