Fix problem with sorting the window frame