Fixes for selection handling