diff --git a/lib/i18n/tasks/data/file_system_base.rb b/lib/i18n/tasks/data/file_system_base.rb
index <HASH>..<HASH> 100644
--- a/lib/i18n/tasks/data/file_system_base.rb
+++ b/lib/i18n/tasks/data/file_system_base.rb
@@ -48,7 +48,7 @@ module I18n::Tasks
         router.route locale, tree do |path, tree_slice|
           write_tree path, tree_slice
         end
-        @trees&.delete(locale)
+        @trees.delete(locale) if @trees
         @available_locales = nil
       end
 
diff --git a/lib/i18n/tasks/data/tree/traversal.rb b/lib/i18n/tasks/data/tree/traversal.rb
index <HASH>..<HASH> 100644
--- a/lib/i18n/tasks/data/tree/traversal.rb
+++ b/lib/i18n/tasks/data/tree/traversal.rb
@@ -102,7 +102,7 @@ module I18n::Tasks
         to_remove = []
         each do |node|
           if block.yield(node)
-            node.children&.select_nodes!(&block)
+            node.children.select_nodes!(&block) if node.children
           else
             # removing during each is unsafe
             to_remove << node
revert lonely operator change since we support older rubies