Fix issue with nested waitFor