Fixes py3-related bugs.