diff --git a/cdist/conf/type/__hostname/explorer/has_hostnamectl b/cdist/conf/type/__hostname/explorer/has_hostnamectl
index 9040023d..2f531f30 100755
--- a/cdist/conf/type/__hostname/explorer/has_hostnamectl
+++ b/cdist/conf/type/__hostname/explorer/has_hostnamectl
@@ -21,4 +21,4 @@
 # Check whether system has hostnamectl
 #
 
-command -v hostnamectl || true
+command -v hostnamectl 2>/dev/null || true
diff --git a/cdist/conf/type/__hostname/explorer/max_len b/cdist/conf/type/__hostname/explorer/max_len
index 97d8a142..fb863949 100644
--- a/cdist/conf/type/__hostname/explorer/max_len
+++ b/cdist/conf/type/__hostname/explorer/max_len
@@ -2,7 +2,7 @@
 
 command -v getconf >/dev/null || exit 0
 
-val=$(getconf HOST_NAME_MAX 2>/dev/null)
+val=$(getconf HOST_NAME_MAX 2>/dev/null) || exit 0
 
 if test -n "${val}" -a "${val}" != 'undefined'
 then
diff --git a/cdist/conf/type/__hostname/explorer/persistent_hostname b/cdist/conf/type/__hostname/explorer/persistent_hostname
index 141c44fe..0feb0809 100755
--- a/cdist/conf/type/__hostname/explorer/persistent_hostname
+++ b/cdist/conf/type/__hostname/explorer/persistent_hostname
@@ -22,7 +22,7 @@
 #
 
 # Firstly, check hostnamectl if available.
-if command -v hostnamectl >/dev/null
+if command -v hostnamectl >/dev/null 2>&1
 then
 	hostnamectl status --static && exit 0
 fi
@@ -32,10 +32,10 @@ fi
 case $("$__explorer/os")
 in
 	alpine|archlinux|coreos|debian|devuan|ubuntu)
-		[ -f /etc/hostname ] && cat /etc/hostname
+		test -f /etc/hostname && cat /etc/hostname
 		;;
 	centos|fedora|redhat|scientific)
-		[ -f /etc/sysconfig/network ] \
+		test -f /etc/sysconfig/network \
 			&& (. /etc/sysconfig/network && echo "$HOSTNAME")
 		;;
 	freebsd)