Catch uncaught exceptions and clean up dict merging.