fixing selection bug