diff --git a/corepkgs/fetchurl.nix b/corepkgs/fetchurl.nix
index 64d1f121f81c0c403cfa0499e8250247969bfd89..9ecb2225ba67102ef880550d289121d268f183e5 100644
--- a/corepkgs/fetchurl.nix
+++ b/corepkgs/fetchurl.nix
@@ -16,7 +16,7 @@ derivation {
       if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5;
   outputHashMode = if executable then "recursive" else "flat";
 
-  inherit system url;
+  inherit system url executable;
 
   # No need to double the amount of network traffic
   preferLocalBuild = true;
diff --git a/src/libstore/builtins.cc b/src/libstore/builtins.cc
index 97d6cb9434020e5492ead148c39d0311ec3e3672..25e2e7df30e7ffaf35de0052e3c4c6cbe3183436 100644
--- a/src/libstore/builtins.cc
+++ b/src/libstore/builtins.cc
@@ -14,7 +14,7 @@ void builtinFetchurl(const BasicDerivation & drv)
     if (out == drv.env.end()) throw Error("attribute ‘url’ missing");
     writeFile(out->second, data.data);
 
-    auto executable = drv.env.find("out");
+    auto executable = drv.env.find("executable");
     if (executable != drv.env.end() && executable->second == "1") {
         if (chmod(out->second.c_str(), 0755) == -1)
             throw SysError(format("making ‘%1%’ executable") % out->second);