rearrange some logic in create or link.