updated exception handler