Few fixes to the R code.

Few fixes to the R code.