bugfixes for Python 3