fix some bugs
Merge https://github.com/Wu-Fei/Source-code