patch the correct exception handler (see #1642)