Improves cache of papers and fixes a glitch that broke a paper's lists of linked papers.

When things were removed from userData, the internal cache of a paper
would get out of sync with the contents of userData.papers, and this
broke things in subtle ways.  I removed the internal caches, which is
slightly more inefficient but fixes the glitch.
Fixes some file permissions