improve relayclient function.