More coverage tests and bug fixes.