fix waiting bug