Fix scope issues in p2p