Autopep8 and bugfixes