refine the code a little bit and do the wait again