Fixes for py3 support.