PY3 exception fix