modified exception handler