Rewrite get_dlink logic, try fixed #8