Further bugfixes for python3