\_q and wait bug fix