Fix to temporary file handling for R images