fixed error in link logic