fixing Rscript bug