private synchronized void changeBid(int auction, Bid bid, Bid newBid) {
    Bid activeBid = getBid(auction);
    if (activeBid != null) {
      if (activeBid.same(bid)) {
	bids[auction] = newBid;
      } else {
	Bid child;
	while ((child = activeBid.getReplacing()) != null && !child.same(bid))
	  {
	    activeBid = child;
	  }
	if (child != null && child.same(bid)) {
	  activeBid.setReplacing(newBid);
	}
      }
    }
  }