Fix wait problem