Tests for error handling and related (minor™) fixes.