fixed var decl in waitFor