Added debugging code in rpc handler