various fixes for py3