diff --git a/bin/cdist-type-emulator b/bin/cdist-type-emulator
index 0b9a10ed..17b6cae6 100755
--- a/bin/cdist-type-emulator
+++ b/bin/cdist-type-emulator
@@ -27,26 +27,39 @@
 . cdist-config
 set -eu
 
+################################################################################
+# Prepare object and type
+#
+
 __cdist_type="$__cdist_myname"
 
 # Find out whether type is a singleton or regular type
 if [ -f "$(__cdist_type_singleton "$__cdist_type")" ]; then
-   __cdist_object_id="singleton"
+   __cdist_object_id="$__cdist_name_singleton"
 else
    [ $# -ge 1 ] || __cdist_usage "<id> <options>"
    __cdist_object_id="$1"; shift
 fi
 
-echo "$__cdist_object_id" | grep -q "^${__cdist_sane_regexp}\$" || \
+# Verify object id
+__cdist_object_id_sane=$(echo "$__cdist_object_id" | grep "^${__cdist_sane_regexp}\$")
+if [ -z "$__cdist_object_id_sane" ]; then
    __cdist_usage "Insane object id, ${__cdist_object_id}."
-
-# Remove double slash if id begins with /
-if [ "$(echo $__cdist_object_id | grep "^/")" ]; then
-   __cdist_object="${__cdist_type}${__cdist_object_id}"
-else
-   __cdist_object="${__cdist_type}/${__cdist_object_id}"
 fi
 
+# Prevent double slash if id begins with /
+if [ "$(echo $__cdist_object_id | grep "^/")" ]; then
+   __cdist_object_self="${__cdist_type}${__cdist_object_id}"
+else
+   __cdist_object_self="${__cdist_type}/${__cdist_object_id}"
+fi
+
+################################################################################
+# Verify object
+#
+
+
+
 __cdist_ddir="$(__cdist_object_dir "$__cdist_object")"
 __cdist_parameter_dir="$(__cdist_object_parameter_dir "$__cdist_object")"