Fix py3 compat issues