adding debug code to RPC layer