Fixed error reporting if error in R script