Update unit tests and fix errors uncovered by the tests

Signed-off-by: Joseph A. Lutz <CipherWizard@cipherwizard.net>