fix R script