Fix bug with scopes when within_window is invoked inside within
Also fix intermittent spec failures