fix wait issue