changed order of statements in querywindow