fix some waiting bugs