Additional unit tests and fixes.