Fixing exception handling.