Fixing link ids to related records