fixed R Script