fix bug in peers handling