added check for typeahead element