Selected Elements fix

Yet another fix for selected elements : almost everything worked as expected except top level nodes.