solve the main problem.and also exist small bugs.