use pickle instead of yaml, various improvements and fixes

Why need this for `exception()`?