Ah, I see. It seems I wrote code correctly for `Proc` argument.
```ruby
switch_to_window(window_or_handle) unless original == window_or_handle
scopes << nil
```
should be situated outside of `begin` block. I'll try to make this change and see it it will solve usage scenarios above.