added error echck in p2p