Bug fixes, and a couple PEP8 changes.