fixed tag checking to actually have correct logic