Correctly clear Python exceptions before continuing.
Misc corrections.