fixed minor issue on the r script