fix linting errors and tests