Fixed the bug, and async process have changed.

When a tab was closed, fixed the bug that doesn't work correctly If you are setting the option that latest tab.
The code of async process is changed to speed up.
Add the debug codes.