Fix selection event handling as discussed in previous commit