fix bugs,and initial functioning version