Corrected Exception handling