Fix bugs.
Fix bugs, delete dead code.