Added code to auto-create tmpdir