fix window selection bug