Fix bug in window