Fixing the Exception handling.