Exception handling fixes

Fixes VS crashes.

When testing, please look in the (debugee) output window for unexpected exceptions.