Fixed #646 sending background exception to the global UncaughtExceptionHandler

See #646 and #727