fix selection handling