diff --git a/support/bin/rtcds.in b/support/bin/rtcds.in
index 9650c8a18d9c9ba8132f3bb89210bb322692b734..1fcc99643e770580aa09e8e3f1ef3a90406e9170 100755
--- a/support/bin/rtcds.in
+++ b/support/bin/rtcds.in
@@ -1,6 +1,14 @@
 #!/bin/bash -e
 
+log() {
+    echo "$@" >&2
+}
+
 RTS_VERSION=${RTS_VERSION:-__VERSION__}
+if [[ "$RTS_VERSION" =~ ._VERSION_. ]] ; then
+    log "RTS_VERSION variable not set."
+    exit 1
+fi
 
 # this should define all USER_VARS (see below)
 ENV_FILE=${RTS_ENV:-/etc/advligorts/env}
@@ -31,10 +39,6 @@ EXPORT_VARS=(${USER_VARS[@]} site ifo CDS_SRC CDS_IFO_SRC)
 
 ##################################################
 
-log() {
-    echo "$@" >&2
-}
-
 check_env() {
     for var in ${USER_VARS[*]} ; do
 	if [ ! "${!var}" ] ; then