If the tempDir is not writable, try the system's global cache dir

This fixes #51