fix bug: check tag length