catch unexpected exceptions to prevent halting