exporting BUILD_DIR didn't work, so set the working directory explicitly in the R code