some changes on peer.c and peer.h