add replace feature for chain