   """
   @spec update_in(Access.t, nonempty_list(term), (term -> term)) :: Access.t
   def update_in(data, keys, fun)
-  def update_in(data, [h], fun),   do: Access.update(data, h, fun)
-  def update_in(data, [h|t], fun), do: Access.update(data, h, &update_in(&1 || %{}, t, fun))
+  def update_in(data, [h], fun), do: Access.update(data, h, fun)
+  def update_in(data, [h|t], fun) do
+    Access.update(data, h, &update_in(case(&1, do: (nil -> %{}; o -> o)), t, fun))
+  end
 
   @doc """
   Converts the argument to a string according to the

      iex> get_in(users, ["josé", :age])
      27

  In case any of entries in the middle return nil, nil will be returned
  as per the Access protocol:

      iex> users = %{"josé" => %{age: 27}, "ericmj" => %{age: 23}}

      iex> update_in(users, ["josé", :age], &(&1 + 1))
      %{"josé" => %{age: 28}, "ericmj" => %{age: 23}}

  In case any of entries in the middle returns `nil`, a map is dynamically
  created:

      iex> users = %{"josé" => %{age: 27}, "ericmj" => %{age: 23}}
