simplified temp dir code as sys_get_temp_dir() is always defined