better tag detection