if path is undef, generate temp path