Exception fixes

Catch and fix some exceptions.