fix segfault with mouse selection. (thx anonymous)