fix: exception and thread syntax to make it py3k compatible