Various minor improvements.
Some test fixes.