Fixed exception handling that led to exception type slicing in some cases and simply inefficient code in others.