Fixing the delete profiles when there is dependencies