fix py3 exception errors