updated references to R scripts and create tmp on the fly