add some comment and fix one context switch bug