Second fix to ForeignKeyReplacement