fix wait variable