Residual window bug fix