Fix some pep8, pyflakes and merge bugs.