Fix a few bugs and linting.