Minor changes to exception handling.