added optional permission to Temp::dir