Fix tempdir() permission issue. Simplify naming.