Fix bug in window extent determination