Fixed all code bugs, there still exist a build error.