Replaced the pickle reg db with simpler flat files.

Closes #327
Added a script to upgrade old-style reg dbs.
Handle corrupted reg db files.
Fixed a reg function name.
Merge pull request #764 from hjoliver/replace-regdb

Replaced the pickle reg db with simpler flat files.