diff --git a/bin/cdist-deploy-to b/bin/cdist-deploy-to
index 07e0459a..d122ac08 100755
--- a/bin/cdist-deploy-to
+++ b/bin/cdist-deploy-to
@@ -50,9 +50,7 @@ cdist-explorer-run-global "$__cdist_target_host"
cdist-manifest-run-init "$__cdist_target_host"
cdist-manifest-run-all "$__cdist_target_host"
cdist-object-explorer-all "$__cdist_target_host"
-
-# Generate code for all objects
-cdist-object-gencode-all "$__cdist_target_host" "$__cdist_out_object_dir"
+cdist-object-gencode-all "$__cdist_target_host"
# Transfer all objects including code
cdist-dir push "$__cdist_target_host" "$__cdist_out_object_dir" \
diff --git a/bin/cdist-object-gencode-all b/bin/cdist-object-gencode-all
index 40c39fd4..024e4a69 100755
--- a/bin/cdist-object-gencode-all
+++ b/bin/cdist-object-gencode-all
@@ -18,29 +18,24 @@
# along with cdist. If not, see .
#
#
-# For each created object create the code to be executed on the
-# target.
+# For each created object create the code to be executed on the target.
#
. cdist-config
-
-if [ $# -ne 2 ]; then
- __cdist_usage " "
-fi
+[ $# -eq 1 ] || __cdist_usage ""
set -eu
__cdist_target_host="$1"; shift
-__cdist_object_base_dir="$1"; shift
-__cdist_object_list "$__cdist_object_base_dir" > "$__cdist_tmp_file"
+__cdist_object_list "$__cdist_out_object_dir" > "$__cdist_tmp_file"
while read object; do
code="$(__cdist_object_code "$object")"
echo "Generating code for $object ..."
cdist-object-gencode "$__cdist_target_host" \
- "$__cdist_object_base_dir" \
+ "$__cdist_out_object_dir" \
"$object" > "${code}"
chmod u+x "${code}"