bug- & pep8 fixes