Made last  window references pointing to a local variable