more py3 porting fixes