diff --git a/workflow/rules/kallisto_index.rules b/workflow/rules/kallisto_index.rules
index 738aeda637bd8d47245bc8df463ad0765477b24d..879418d56953836e660239488e48c948a7e9d80c 100755
--- a/workflow/rules/kallisto_index.rules
+++ b/workflow/rules/kallisto_index.rules
@@ -35,7 +35,7 @@ rule kallisto_index:
     log:
         kallisto_index_log
     threads:
-        config['pseudomapping']['threads']
+        config['kallisto']['threads']
     envmodules:
         "kallisto/0.46.2"
     shell:
diff --git a/workflow/rules/kallisto_quant.rules b/workflow/rules/kallisto_quant.rules
index 56f2b296972bf05b59ce22ebff6e489d44aa9ffb..a17d425265a75acc14948a2d59f1111d9ffa79cb 100755
--- a/workflow/rules/kallisto_quant.rules
+++ b/workflow/rules/kallisto_quant.rules
@@ -37,7 +37,7 @@ rule kallisto_quant:
     log:
         kallisto_pseudo_log
     threads:
-        config['pseudomapping']['threads']
+        config['kallisto']['threads']
     envmodules:
         "kallisto/0.46.2"
     shell:
diff --git a/workflow/rules/sortmerna.rules b/workflow/rules/sortmerna.rules
index 58e89a5e42884cf7b8d9c25cc7c10436fee93857..9fed2f6914178932063267e189952fe5adee7bf0 100755
--- a/workflow/rules/sortmerna.rules
+++ b/workflow/rules/sortmerna.rules
@@ -74,13 +74,13 @@ rule sortmerna:
             mv out_paired_rev.fq${{ext}} {{outnorRNA[1]}}
             mv out_paired_ribo_fwd.fq${{ext}} {{outrRNA[0]}}
             mv out_paired_ribo_rev.fq${{ext}} {{outrRNA[1]}}
-            mv output.rRNA.log {log.out}
+            #mv output.rRNA.log {log.out}
 
         else
             sortmerna --ref ${{fasta}} --idx-dir ${{idxdir}} --workdir {params.tmpdir}/{wildcards.SAMPLE} -threads {threads} --reads {input.fastq} --aligned output.rRNA --fastx --other output.no_rRNA  -v  > {log.out} 2> {log.err}
             mv output.no_rRNA.fq${{ext}} {output.no_rRNA}
             mv output.rRNA.fq${{ext}} {output.rRNA}
-            mv output.rRNA.log {log.out}
+            #mv output.rRNA.log {log.out}
         fi
 
 
diff --git a/workflow/rules/star_index.rules b/workflow/rules/star_index.rules
index aedc51efbbc7790d310973e415f7e5e31993b874..b14843f6b6fbb8fde0ae8781e80ebaaa51216dfd 100755
--- a/workflow/rules/star_index.rules
+++ b/workflow/rules/star_index.rules
@@ -43,18 +43,19 @@ rule star_index:
     shell:
         """
         set +o pipefail
-        GenomeLength=`grep -v ">" {input} | tr -d '\n' | wc -c`
+        GenomeLength=`grep -v ">" {input.fasta} | tr -d '\n' | wc -c`
         SAindex=$(echo $GenomeLength | awk '{{a=log($1)/2 - 1; if (a>14) a=14; printf("%d\\n",a)}}')
-        
-        
+        NumberOfReferences=`grep -c ">" {input.fasta}`
+        ChrBin=$(echo | awk -v g=$GenomeLength -v n=$NumberOfReferences '{{a=log(g/n); if (a>18) a=18; printf("%d\\n",a)}}' )
+
         if [[ -s {input.gff_file} && {input.gff_file} == "*.gtf"  ]]
         then
-            STAR --runMode genomeGenerate --genomeFastaFiles {input.fasta} --genomeDir {params.wkdir} --runThreadN {threads} --sjdbGTFfile {input.gff_file} --genomeSAindexNbases $SAindex
+            STAR --runMode genomeGenerate --genomeFastaFiles {input.fasta} --genomeDir {params.wkdir} --runThreadN {threads} --sjdbGTFfile {input.gff_file} --genomeSAindexNbases $SAindex --genomeChrBinNbits $ChrBin
         elif [[ -s {input.gff_file} && {input.gff_file} == "*.gff" ]]
         then
-             STAR --runMode genomeGenerate --genomeFastaFiles {input.fasta} --genomeDir {params.wkdir} --runThreadN {threads} --sjdbGTFfile {input.gff_file} --sjdbGTFtagExonParentTranscript Parent --genomeSAindexNbases $SAindex
+             STAR --runMode genomeGenerate --genomeFastaFiles {input.fasta} --genomeDir {params.wkdir} --runThreadN {threads} --sjdbGTFfile {input.gff_file} --sjdbGTFtagExonParentTranscript Parent --genomeSAindexNbases $SAindex --genomeChrBinNbits $ChrBin
         else
-            STAR --runMode genomeGenerate --genomeFastaFiles {input.fasta} --genomeDir {params.wkdir} --runThreadN {threads} --genomeSAindexNbases $SAindex
+            STAR --runMode genomeGenerate --genomeFastaFiles {input.fasta} --genomeDir {params.wkdir} --runThreadN {threads} --genomeSAindexNbases $SAindex --genomeChrBinNbits $ChrBin
         fi
         
         samtools faidx {input.fasta}