Fix unit test failures and pylint errors.