Fix pep8 warnings and fix work with ST2