various fixes to network cleanup, move p2p back to main thread