add Link API; fix race in test and fmt