Various bug fixes.  Currently tracking down a really annoying and tricky bug which is causing an exception somewhere.