         else
           value -> {key, value}
         end
+
       key when is_atom(key) ->
         {key, nil}
+
       other ->
-        raise ArgumentError, "#{type} fields must be atoms, got: #{inspect other}"
-    end, fields)
+        raise ArgumentError, "#{type} fields must be atoms, got: #{inspect(other)}"
+    end
+
+    :lists.map(normalizer_fun, fields)
   end
 
   # Callback invoked from record/0 and record/1 macros.

  # Gets the index of field.
  defp index(tag, fields, field) do
    if index = find_index(fields, field, 0) do
      index - 1 # Convert to Elixir index
    else
      raise ArgumentError, "record #{inspect tag} does not have the key: #{inspect field}"
    end
  end


      tag = tag || name
      fields = Record.__fields__(:defrecordp, kv)

      defmacrop unquote(name)(args \\ []) do
        Record.__access__(unquote(tag), unquote(fields), args, __CALLER__)
      end

      defmacrop unquote(name)(record, args) do
        Record.__access__(unquote(tag), unquote(fields), record, args, __CALLER__)
      end
    end
