Small bug fix in R spectrum script