minor update of the R code