Window state fixes