Remove unused imports.
Add test for issue #77.
Fix flake8 errors.