More RPC changes for SP

NULL pointer check is needed.........
below too, similar code