Fix duplication of custom rules.

Rules may depend on fields.  These internal field IDs in the targets now
also get updated to their new names (GitHub: #19).