Replaced undefined variables with link_id