Fix strange TypeError after py3k migrate.