fix some foreign key cases