fix selected item detection