fix potential lab 4 part A bug, make it more stable, tested for 100 times without failure