Fixed exception when running a background task.
Improved exception handler to show all exceptions.