+
+    /* If we have slaves attached we want to replicate this command as
+     * EVAL instead of EVALSHA. We do this also in the AOF as currently there
+     * is no easy way to propagate a command in a different way in the AOF
+     * and in the replication link.
+     *
+     * IMPROVEMENT POSSIBLE:
+     * 1) Replicate this command as EVALSHA in the AOF.
+     * 2) Remember what slave already received a given script, and replicate
+     *    the EVALSHA against this slaves when possible.
+     */
+    if (evalsha) {
+        robj *script = dictFetchValue(server.lua_scripts,c->argv[1]->ptr);
+
+        redisAssert(script != NULL);
+        rewriteClientCommandArgument(c,0,
+            resetRefCount(createStringObject("EVAL",4)));
+        rewriteClientCommandArgument(c,1,script);
+    }