diff --git a/scripts/init.sh b/scripts/init.sh
index 5cb26dfcf2c3de16ad8b475eb438b959021062d5..7f24f7ff92dd27889a0d35a1dd6dc170714536b6 100644
--- a/scripts/init.sh
+++ b/scripts/init.sh
@@ -16,7 +16,7 @@ module load $(module avail -o modulepath -t -C "python-${PYTHON_VERSION}" 2>&1 |
 module load $(module avail -o modulepath -t -C "python-${PYTHON_VERSION}" 2>&1 | grep "matplotlib/")
 module load $(module avail -o modulepath -t -C "python-${PYTHON_VERSION}" 2>&1 | grep "pandas/")
 module load cuda/$CUDA_VERSION
-CUDNN_MOD=$(module avail -o modulepath -t cudnn | grep "cuda-${CUDA_VERSION}" 2>&1 | sort | tail -n1)
+CUDNN_MOD=$(module avail -o modulepath -t cudnn 2>&1 | grep "cuda-${CUDA_VERSION}" | sort | tail -n1)
 if [[ ${CUDNN_MOD} ]]
 then
     module load ${CUDNN_MOD}