minor corrections to R Script