Added an exception handler