fix wait flag