fixed some problems with selecting items from the treeview