fix foreign key delete bug