Fixed exception handling with loaded data.

Fixes #2153.

Review please? @danielgtaylor