Several more bug fixes.  the cache and cache_api tests now pass.

Many bugs remain -- while we compile and link, we do not pass 
regression tests.