fixed error when current working directory is not writable