Fix incorrect selection handling.