     File.mkdir_p!(Path.dirname(manifest))
 
     modules =
-      for module(beam: beam, binary: binary) = module <- modules do
+      for module(binary: binary, module: module) = entry <- modules do
+        beam = Atom.to_string(module) <> ".beam"
         if binary do
           beam_path = Path.join(compile_path, beam)
           File.write!(beam_path, binary)
           File.touch!(beam_path, timestamp)
         end
-        module(module, binary: nil)
+        module(entry, binary: nil, beam: beam)
       end
 
     manifest_data =

  end

  defp each_module(pid, cwd, source, module, binary) do
    beam = Atom.to_string(module) <> ".beam"

    {compile_references, runtime_references} = Kernel.LexicalTracker.remote_references(module)

    compile_references =

        module: module,
        kind: kind,
        source: source,
        beam: nil, # They are calculated when writing the manifest
        binary: binary
      )

