bug fix, doc improvements, pep8