Fix foreign keys in models.