Fix autoselect on empty elements