             _ = @enforce_keys
             def __struct__(kv) do
               :lists.foldl(fn {key, val}, acc ->
-                :maps.update(key, val, acc)
+                Map.replace!(acc, key, val)
               end, __struct__(), kv)
             end
           end

            def __struct__(kv) do
              {map, keys} =
                Enum.reduce(kv, {__struct__(), @enforce_keys}, fn {key, val}, {map, keys} ->
                  {:maps.update(key, val, map), :lists.delete(key, keys)}
                end)
              case keys do
                [] -> map

    struct(struct, kv, fn
      {:__struct__, _}, acc -> acc
      {key, val}, acc ->
        Map.replace!(acc, key, val)
    end)
  end

