fix foreign key dismatch bug