slightly better tag parsing