better R script handling (scripts are broken)