Improving the element/selector check