Continuation of commit 3bd4168
Added uncaught exception handling for background threads