Fixed bugs in RPC from wanton refactoring