Py2/3: python-modernize and initial bug fixes