added tmpfile function