wait return bug fix