fix the foreign key constraint while deleting