added exception handler.