Improve fatal error reporting and self-testing.
Remove debug code that was accidentally included in a previous commit.