More tests of the top-level API, and more fixes.