improve uncaught exception handler