Tests and related fixes.