Fix window not clearing sometimes