Fixed window selection bug