Added a small exception handler.