Fixed an error in exception handling.