Fix "wait" bug