Fixed a minor bug with exception handling.