Add a few unit tests for untested code; remove a useless conditional.