modify interrupt handler, and fix some bugs.