Fix tempdir issues