Update

-another wait function
-fixed wrong variable