diff --git a/01b_MesobromionCluster.R b/01b_MesobromionCluster.R
index 413638d927194a6cfb07dff8d0e8943ec7b2ff11..f92c85b44361cf4583940a8803a716bfb629fd48 100644
--- a/01b_MesobromionCluster.R
+++ b/01b_MesobromionCluster.R
@@ -55,7 +55,7 @@ get.best <- function(x, N){
 
 
 Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY.bootstrap", 
-                        combinations=c("all", "sequential"), max.inter.t, chunkn, chunk.i, nperm=199, ncores=1){
+                        combinations=c("all", "sequential"), max.inter.t, chunkn, chunk.i, nperm=199, ncores){
   
   if(ncores>1){
     require(parallel)
@@ -151,7 +151,7 @@ Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY
       
       ## start main foreach loop
       print(paste("Start main loop - round", nround))
-      corXY.output <- foreach(ch=1:length(allcomb.t, .combine=rbind) %myinfix% {
+      corXY.output <- foreach(ch=1:length(allcomb.t), .combine=rbind) %myinfix% {
         allcomb.i <- allcomb.t[ch]
         print(paste("Running on", length(allcomb.i),"out of", nall, "combinations"))
         
diff --git a/cli_01b.r b/cli_01b.r
index 79d61771460d9216282101b47de3eb2749e7e52f..51a65a6948b4bee01fa52ac119faa687e1012518 100644
--- a/cli_01b.r
+++ b/cli_01b.r
@@ -88,8 +88,5 @@ ncores         <- cli$options$ncores
 
 source("01b_MesobromionCluster.R")
 
-Mesobromion(species.path, traits.path, output, myfunction, combinations, max.inter.t, 
-            chunkn, chunk.i, nperm)
-
 Mesobromion(species.path, traits.path, output, myfunction, combinations, max.inter.t, 
             chunkn, chunk.i, nperm, ncores)
diff --git a/submit_01b.sh b/submit_01b.sh
index c634b3d8bd0c82de4a3b9967bfeddb72e74c01a2..af6a9f1e6e75ef966b377fd50679334e181f8ed1 100644
--- a/submit_01b.sh
+++ b/submit_01b.sh
@@ -24,6 +24,7 @@ Rscript \
     --chunk.i NA \
     --chunkn 32 \
     --nperm 99 \
+    --ncores ${NSLOTS:-1} \
     /data/splot/HIDDEN/species.out.10perc.txt \
     /data/splot/HIDDEN/traits.out.10perc.txt \
     "$output" \