fix test in older Py3.x versions, minor cleanups