fix bugs in lab3

fix bugs in lab3