diff --git a/bin/slurm_calibrate.sh b/bin/slurm_calibrate.sh
index 0e22b20ca25f2367017a340aba3e247201ea7b6e..b313426c770e009b5503e7a21f123c0f132b75a6 100755
--- a/bin/slurm_calibrate.sh
+++ b/bin/slurm_calibrate.sh
@@ -37,7 +37,7 @@ echo "Starting influx feeder"
 export MPLBACKEND=AGG
 
 # start an ip cluster if requested
-if [ "${uuid}" != "NO_CLUSTER" ]
+if [ "${ipcluster_profile}" != "NO_CLUSTER" ]
 then
     ${python_path} -m IPython profile create ${ipcluster_profile} --parallel
     ${python_path} -m ipyparallel.cluster start --n=${cluster_cores} --profile=${ipcluster_profile} --daemon &
@@ -49,7 +49,7 @@ echo "Running script"
 ${python_path} -m nbconvert --to rst --ExecutePreprocessor.timeout=36000 --ExecutePreprocessor.allow_errors=True --TemplateExporter.exclude_input=True --execute ${nb_path}
 
 # stop the cluster if requested
-if [ "${uuid}" != "NO_CLUSTER" ]
+if [ "${ipcluster_profile}" != "NO_CLUSTER" ]
 then
     ${python_path} -m ipyparallel.cluster stop --profile=${ipcluster_profile}
     profile_path=$(${python_path} -m IPython locate profile ${ipcluster_profile})